Optimal. Leaf size=92 \[ -\frac {4 i a^2 \tanh ^{-1}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {c-i d}}\right )}{(c-i d)^{3/2} f}+\frac {2 a^2 (i c-d)}{d (i c+d) f \sqrt {c+d \tan (e+f x)}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.16, antiderivative size = 92, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 30, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {3623, 3618, 65,
214} \begin {gather*} \frac {2 a^2 (-d+i c)}{d f (d+i c) \sqrt {c+d \tan (e+f x)}}-\frac {4 i a^2 \tanh ^{-1}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {c-i d}}\right )}{f (c-i d)^{3/2}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 65
Rule 214
Rule 3618
Rule 3623
Rubi steps
\begin {align*} \int \frac {(a+i a \tan (e+f x))^2}{(c+d \tan (e+f x))^{3/2}} \, dx &=\frac {2 a^2 (i c-d)}{d (i c+d) f \sqrt {c+d \tan (e+f x)}}+\frac {\int \frac {2 a^2 (c+i d)+2 a^2 (i c-d) \tan (e+f x)}{\sqrt {c+d \tan (e+f x)}} \, dx}{c^2+d^2}\\ &=\frac {2 a^2 (i c-d)}{d (i c+d) f \sqrt {c+d \tan (e+f x)}}-\frac {\left (4 a^4 (c+i d)\right ) \text {Subst}\left (\int \frac {1}{\left (4 a^4 (i c-d)^2+2 a^2 (c+i d) x\right ) \sqrt {c+\frac {d x}{2 a^2 (i c-d)}}} \, dx,x,2 a^2 (i c-d) \tan (e+f x)\right )}{(i c+d) f}\\ &=\frac {2 a^2 (i c-d)}{d (i c+d) f \sqrt {c+d \tan (e+f x)}}-\frac {\left (16 a^6 (c+i d)^2\right ) \text {Subst}\left (\int \frac {1}{4 a^4 (i c-d)^2-\frac {4 a^4 c (i c-d) (c+i d)}{d}+\frac {4 a^4 (i c-d) (c+i d) x^2}{d}} \, dx,x,\sqrt {c+d \tan (e+f x)}\right )}{(c-i d) d f}\\ &=-\frac {4 i a^2 \tanh ^{-1}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {c-i d}}\right )}{(c-i d)^{3/2} f}+\frac {2 a^2 (i c-d)}{d (i c+d) f \sqrt {c+d \tan (e+f x)}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(189\) vs. \(2(92)=184\).
time = 3.52, size = 189, normalized size = 2.05 \begin {gather*} \frac {a^2 (\cos (e+f x)+i \sin (e+f x))^2 \left (-\frac {4 i e^{-2 i e} \tanh ^{-1}\left (\frac {\sqrt {c-\frac {i d \left (-1+e^{2 i (e+f x)}\right )}{1+e^{2 i (e+f x)}}}}{\sqrt {c-i d}}\right )}{(c-i d)^{3/2}}+\frac {2 (c+i d) \cos (e+f x) (\cos (2 e)-i \sin (2 e)) \sqrt {c+d \tan (e+f x)}}{(c-i d) d (c \cos (e+f x)+d \sin (e+f x))}\right )}{f (\cos (f x)+i \sin (f x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 1029 vs. \(2 (79 ) = 158\).
time = 0.29, size = 1030, normalized size = 11.20
method | result | size |
derivativedivides | \(\frac {2 a^{2} \left (-\frac {2 d \left (\frac {\frac {\left (i \sqrt {c^{2}+d^{2}}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c +i \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c^{2}-i \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, d^{2}-\sqrt {c^{2}+d^{2}}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, d -2 \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c d \right ) \ln \left (d \tan \left (f x +e \right )+c +\sqrt {c +d \tan \left (f x +e \right )}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}+\sqrt {c^{2}+d^{2}}\right )}{2}+\frac {2 \left (2 i c^{2} \sqrt {c^{2}+d^{2}}-2 i d^{2} \sqrt {c^{2}+d^{2}}+2 i c^{3}-2 i c \,d^{2}-4 c d \sqrt {c^{2}+d^{2}}-4 c^{2} d -\frac {\left (i \sqrt {c^{2}+d^{2}}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c +i \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c^{2}-i \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, d^{2}-\sqrt {c^{2}+d^{2}}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, d -2 \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c d \right ) \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}}{2}\right ) \arctan \left (\frac {2 \sqrt {c +d \tan \left (f x +e \right )}+\sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}}{\sqrt {2 \sqrt {c^{2}+d^{2}}-2 c}}\right )}{\sqrt {2 \sqrt {c^{2}+d^{2}}-2 c}}}{4 \left (\sqrt {c^{2}+d^{2}}+c \right ) \sqrt {c^{2}+d^{2}}}+\frac {\frac {\left (-i \sqrt {c^{2}+d^{2}}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c -i \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c^{2}+i \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, d^{2}+\sqrt {c^{2}+d^{2}}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, d +2 \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c d \right ) \ln \left (d \tan \left (f x +e \right )+c -\sqrt {c +d \tan \left (f x +e \right )}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}+\sqrt {c^{2}+d^{2}}\right )}{2}+\frac {2 \left (2 i c^{2} \sqrt {c^{2}+d^{2}}-2 i d^{2} \sqrt {c^{2}+d^{2}}+2 i c^{3}-2 i c \,d^{2}-4 c d \sqrt {c^{2}+d^{2}}-4 c^{2} d +\frac {\left (-i \sqrt {c^{2}+d^{2}}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c -i \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c^{2}+i \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, d^{2}+\sqrt {c^{2}+d^{2}}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, d +2 \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c d \right ) \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}}{2}\right ) \arctan \left (\frac {2 \sqrt {c +d \tan \left (f x +e \right )}-\sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}}{\sqrt {2 \sqrt {c^{2}+d^{2}}-2 c}}\right )}{\sqrt {2 \sqrt {c^{2}+d^{2}}-2 c}}}{4 \left (\sqrt {c^{2}+d^{2}}+c \right ) \sqrt {c^{2}+d^{2}}}\right )}{c^{2}+d^{2}}-\frac {-2 i c d -c^{2}+d^{2}}{\left (c^{2}+d^{2}\right ) \sqrt {c +d \tan \left (f x +e \right )}}\right )}{f d}\) | \(1030\) |
default | \(\frac {2 a^{2} \left (-\frac {2 d \left (\frac {\frac {\left (i \sqrt {c^{2}+d^{2}}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c +i \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c^{2}-i \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, d^{2}-\sqrt {c^{2}+d^{2}}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, d -2 \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c d \right ) \ln \left (d \tan \left (f x +e \right )+c +\sqrt {c +d \tan \left (f x +e \right )}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}+\sqrt {c^{2}+d^{2}}\right )}{2}+\frac {2 \left (2 i c^{2} \sqrt {c^{2}+d^{2}}-2 i d^{2} \sqrt {c^{2}+d^{2}}+2 i c^{3}-2 i c \,d^{2}-4 c d \sqrt {c^{2}+d^{2}}-4 c^{2} d -\frac {\left (i \sqrt {c^{2}+d^{2}}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c +i \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c^{2}-i \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, d^{2}-\sqrt {c^{2}+d^{2}}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, d -2 \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c d \right ) \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}}{2}\right ) \arctan \left (\frac {2 \sqrt {c +d \tan \left (f x +e \right )}+\sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}}{\sqrt {2 \sqrt {c^{2}+d^{2}}-2 c}}\right )}{\sqrt {2 \sqrt {c^{2}+d^{2}}-2 c}}}{4 \left (\sqrt {c^{2}+d^{2}}+c \right ) \sqrt {c^{2}+d^{2}}}+\frac {\frac {\left (-i \sqrt {c^{2}+d^{2}}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c -i \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c^{2}+i \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, d^{2}+\sqrt {c^{2}+d^{2}}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, d +2 \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c d \right ) \ln \left (d \tan \left (f x +e \right )+c -\sqrt {c +d \tan \left (f x +e \right )}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}+\sqrt {c^{2}+d^{2}}\right )}{2}+\frac {2 \left (2 i c^{2} \sqrt {c^{2}+d^{2}}-2 i d^{2} \sqrt {c^{2}+d^{2}}+2 i c^{3}-2 i c \,d^{2}-4 c d \sqrt {c^{2}+d^{2}}-4 c^{2} d +\frac {\left (-i \sqrt {c^{2}+d^{2}}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c -i \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c^{2}+i \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, d^{2}+\sqrt {c^{2}+d^{2}}\, \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, d +2 \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}\, c d \right ) \sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}}{2}\right ) \arctan \left (\frac {2 \sqrt {c +d \tan \left (f x +e \right )}-\sqrt {2 \sqrt {c^{2}+d^{2}}+2 c}}{\sqrt {2 \sqrt {c^{2}+d^{2}}-2 c}}\right )}{\sqrt {2 \sqrt {c^{2}+d^{2}}-2 c}}}{4 \left (\sqrt {c^{2}+d^{2}}+c \right ) \sqrt {c^{2}+d^{2}}}\right )}{c^{2}+d^{2}}-\frac {-2 i c d -c^{2}+d^{2}}{\left (c^{2}+d^{2}\right ) \sqrt {c +d \tan \left (f x +e \right )}}\right )}{f d}\) | \(1030\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 600 vs. \(2 (76) = 152\).
time = 0.87, size = 600, normalized size = 6.52 \begin {gather*} \frac {{\left ({\left (c^{2} d - 2 i \, c d^{2} - d^{3}\right )} f e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (c^{2} d + d^{3}\right )} f\right )} \sqrt {\frac {16 i \, a^{4}}{{\left (-i \, c^{3} - 3 \, c^{2} d + 3 i \, c d^{2} + d^{3}\right )} f^{2}}} \log \left (\frac {{\left (4 \, a^{2} c + {\left ({\left (i \, c^{2} + 2 \, c d - i \, d^{2}\right )} f e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (i \, c^{2} + 2 \, c d - i \, d^{2}\right )} f\right )} \sqrt {\frac {16 i \, a^{4}}{{\left (-i \, c^{3} - 3 \, c^{2} d + 3 i \, c d^{2} + d^{3}\right )} f^{2}}} \sqrt {\frac {{\left (c - i \, d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + c + i \, d}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}} + 4 \, {\left (a^{2} c - i \, a^{2} d\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}}{2 \, a^{2}}\right ) - {\left ({\left (c^{2} d - 2 i \, c d^{2} - d^{3}\right )} f e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (c^{2} d + d^{3}\right )} f\right )} \sqrt {\frac {16 i \, a^{4}}{{\left (-i \, c^{3} - 3 \, c^{2} d + 3 i \, c d^{2} + d^{3}\right )} f^{2}}} \log \left (\frac {{\left (4 \, a^{2} c + {\left ({\left (-i \, c^{2} - 2 \, c d + i \, d^{2}\right )} f e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (-i \, c^{2} - 2 \, c d + i \, d^{2}\right )} f\right )} \sqrt {\frac {16 i \, a^{4}}{{\left (-i \, c^{3} - 3 \, c^{2} d + 3 i \, c d^{2} + d^{3}\right )} f^{2}}} \sqrt {\frac {{\left (c - i \, d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + c + i \, d}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}} + 4 \, {\left (a^{2} c - i \, a^{2} d\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}}{2 \, a^{2}}\right ) + 8 \, {\left (a^{2} c + i \, a^{2} d + {\left (a^{2} c + i \, a^{2} d\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \sqrt {\frac {{\left (c - i \, d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + c + i \, d}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}}}{4 \, {\left ({\left (c^{2} d - 2 i \, c d^{2} - d^{3}\right )} f e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (c^{2} d + d^{3}\right )} f\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} - a^{2} \left (\int \frac {\tan ^{2}{\left (e + f x \right )}}{c \sqrt {c + d \tan {\left (e + f x \right )}} + d \sqrt {c + d \tan {\left (e + f x \right )}} \tan {\left (e + f x \right )}}\, dx + \int \left (- \frac {2 i \tan {\left (e + f x \right )}}{c \sqrt {c + d \tan {\left (e + f x \right )}} + d \sqrt {c + d \tan {\left (e + f x \right )}} \tan {\left (e + f x \right )}}\right )\, dx + \int \left (- \frac {1}{c \sqrt {c + d \tan {\left (e + f x \right )}} + d \sqrt {c + d \tan {\left (e + f x \right )}} \tan {\left (e + f x \right )}}\right )\, dx\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 209 vs. \(2 (76) = 152\).
time = 0.71, size = 209, normalized size = 2.27 \begin {gather*} \frac {8 \, a^{2} \arctan \left (\frac {2 \, {\left (\sqrt {d \tan \left (f x + e\right ) + c} c - \sqrt {c^{2} + d^{2}} \sqrt {d \tan \left (f x + e\right ) + c}\right )}}{c \sqrt {-2 \, c + 2 \, \sqrt {c^{2} + d^{2}}} - i \, \sqrt {-2 \, c + 2 \, \sqrt {c^{2} + d^{2}}} d - \sqrt {c^{2} + d^{2}} \sqrt {-2 \, c + 2 \, \sqrt {c^{2} + d^{2}}}}\right )}{{\left (-i \, c f - d f\right )} \sqrt {-2 \, c + 2 \, \sqrt {c^{2} + d^{2}}} {\left (-\frac {i \, d}{c - \sqrt {c^{2} + d^{2}}} + 1\right )}} + \frac {2 \, {\left (a^{2} c + i \, a^{2} d\right )}}{{\left (c d f - i \, d^{2} f\right )} \sqrt {d \tan \left (f x + e\right ) + c}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 6.38, size = 142, normalized size = 1.54 \begin {gather*} \frac {a^2\,\mathrm {atan}\left (\frac {\sqrt {c+d\,\mathrm {tan}\left (e+f\,x\right )}\,\left (2\,c^4\,f^2+4\,c^2\,d^2\,f^2+2\,d^4\,f^2\right )}{2\,f\,{\left (-c+d\,1{}\mathrm {i}\right )}^{3/2}\,\left (f\,c^3+1{}\mathrm {i}\,f\,c^2\,d+f\,c\,d^2+1{}\mathrm {i}\,f\,d^3\right )}\right )\,4{}\mathrm {i}}{f\,{\left (-c+d\,1{}\mathrm {i}\right )}^{3/2}}+\frac {2\,a^2\,\left (c+d\,1{}\mathrm {i}\right )}{d\,f\,\left (c-d\,1{}\mathrm {i}\right )\,\sqrt {c+d\,\mathrm {tan}\left (e+f\,x\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________